<script setup>
    import { defineEmits } from 'vue';

    const emits = defineEmits(['sendMenu']) // 定义向父组件App.vue发送数据的事件：sendMenu

    // 点击执行send方法，传入对应的实参，调用emits方法，指定事件名称sendMenu，指定参数data
    function send(data) {
        emits("sendMenu", data)
    }
  

</script>

<template>
    <div>
        <ul>
            <li @click="send('java')">java</li><!-- 这里函数的参数要用引号引起来，不然会被当做形参 -->
            <li @click="send('c++')">c++</li>
            <li @click="send('c#')">c#</li>
            <li @click="send('python')">python</li>
            <li @click="send('mysql')">mysql</li>
            <li @click="send('vue')">vue</li>
        </ul>
    </div>
  
</template>

<style scoped>

</style>
